ESLint configuration change

44 views
Skip to first unread message

Mark Banner

unread,
May 25, 2025, 3:22:10 PM (9 days ago) May 25
to dev-pl...@mozilla.org, firefox-dev list

A set of patches has just landed on main, which convert our ESLint configuration to use newer ESLint's "flat" configuration format.

There are a few things to be aware of:

  • If you have previously used node in one of the following directories, you'll need to either remove the node_modules sub-directory from the relevant directories, or run the appropriate command to re-install them (e.g. mach npm ci). You'll definitely need to do this if you see the error Global "AudioWorkletGlobalScope " has leading or trailing whitespace when running ESLint.
    • browser/components/asrouter
    • browser/components/aboutwelcome
    • browser/extensions/newtab
    • tools/ts
  • If you've updated the branch with your editor open, you may need to restart your editor to fully pick up the changes.
  • Environments have changed.
    • /* eslint-env foo */ will no longer work.
    • You will need to either use aknown file naming which represents the file (e.g. *.worker.mjs for a worker), or update the list in eslint-file-globals.config.mjs.
    • Please read the note at the top of eslint-rollouts.config.mjs for the details about options.
  • Ignore File has moved locations
    • The top-level .eslintignore file has now moved to eslint-ignores.config.mjs
  • Due to the way the flat configuration works, all sub-configurations must now be included in the top-level configuration, via eslint-subdirs.config.mjs. However, please do not add to this file without talking to the frontend code reviewers group first. We generally want rules to be consistent across the whole tree, and there may be other ways of achieving what you need.

If you have any general questions, please ask in the #lint:mozilla.org channel (aka Lint and Formatting) on Matrix.

The flat configuration provides a deterministic setup, and paths the way for upgrading to ESLint v9. In turn, this will allow us to pick up some new features in ESLint, and also tidy up a lot of the older configuration code.

Mark.

Reply all
Reply to author
Forward
0 new messages